<template>
    <div class="login-con">
        <div class="login-box">
            <h2>cms管理系统</h2>
            <el-form>
                <el-form-item>
                    <el-input v-model="user"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input type="password" v-model="pwd"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary"  @click="gomain">点击登陆</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>
<script>
    export default {
        name: "login",
        data(){
            return{
                user:'admin',
                pwd:'123456'
            }
        },
        methods: {
            async gomain() {
                let res =await this.$axios.post('http://47.92.50.43:8888/user/login',{username:this.user, pwd:this.pwd})
                if(res.data.success){
                    this.$router.push({path: "/mainpage"});
                }else{
                    this.$message.error('登陆失败');
                }
            }
        }
    };
</script>
<style scoped>
    .login-con {
        width: 100vw;
        height: 100vh;
        background: linear-gradient(to bottom, #fff, #e2e2e2);
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .login-box {
        width: 500px;
        height: 300px;
        box-shadow: 2px 2px 2px #e2e2e2;
        background: #fff;
        border-radius: 10px;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: center
    }
</style>